unit EGroup;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;

type
  TfmGroup = class(TForm)
    Label1: TLabel;
    edName: TEdit;
    btOK: TBitBtn;
    btCancel: TBitBtn;
    procedure edNameEnter(Sender: TObject);
    procedure edNameExit(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmGroup: TfmGroup;

implementation
uses dmIdocqment,Utility;
{$R *.dfm}

procedure TfmGroup.edNameEnter(Sender: TObject);
begin
  SetBackColor(Sender,true);
end;

procedure TfmGroup.edNameExit(Sender: TObject);
begin
  SetBackColor(Sender,false);
end;

procedure TfmGroup.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key=VK_Up then SelectNext(ActiveControl,false,true);
  if Key=VK_Down then SelectNext(ActiveControl,true,true);
  if Key=VK_Escape then btCancel.Click;
end;

procedure TfmGroup.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then SelectNext(ActiveControl,true,true);
end;

end.
